<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="CloudStorage.*" %>
<%
            int size = 0;
            Cart cart = (Cart) session.getAttribute("cart");
            if (cart != null) {
                size = cart.getSize();
            }

           int fileid= Integer.parseInt(request.getParameter("fileid"));
           session.setAttribute("url","viewfile.jsp?fileid=" + fileid);
%>
<html>
    <head>
        <title>CloudShare - View Details</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="style.css" />
        <link rel="stylesheet" type="text/css" href="styles/upload_style.css" />
        <link rel="SHORTCUT ICON" href="images/favicon.ico" />

        <style type="text/css">
            <!--
            #main .inside .block1 {
                text-align: left;
                clear: none;
                float: left;
                margin-left: 250px;
                height: 200px;
            }
            body,td,th {
                color: #64584C;
            }
#main .inside #blocks .upload #upload-text #advanced td {
float:left;
	width: 100;
}
            -->
        </style>
    </head>

    <body>
        <div id="header">
            <div class="inside"> <a href="#" class="logo"><img src="images/logo2.gif" alt="" width="131" height="83" /></a>
                <div id="content">

                </div>
                <p class="slogan">Share on Clouds!</p>
                <div id="cart">
                    <ul>
                        <li><a href="downloadcart.jsp"><img alt="cart" src="images/cart.png">  Download Cart (<%=size%>)</a> </li>
                    </ul>
                </div>
                <a href="faq.jsp" class="rss"><img src="images/rss.jpg" alt="" width="39" height="41" /></a>
            </div>
            <div id="menu">
               <% if (session.getAttribute("status") == null) {%>
                <ul>
                    <li><a href="index.jsp"><img src="images/but_home.jpg" alt="" width="148" height="40" /></a></li>
                    <li><a href="login.jsp"><img src="images/but_login.jpg" alt="" width="147" height="40" /></a></li>
                    <li><a href="register.jsp"><img src="images/but_reg.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="downloads.jsp"><img src="images/but_down.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="upload.jsp"><img src="images/but_upload.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="buy.jsp"><img src="images/but_buy.jpg" alt="" width="146" height="40" /></a></li>

                </ul>
				<% } else { %>
                <ul>
                    <li><a href="index.jsp"><img src="images/but_home.jpg" alt="" width="148" height="40" /></a></li>
                    <li><a href="account.jsp"><img src="images/but_account.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="downloads.jsp"><img src="images/but_down.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="upload.jsp"><img src="images/but_upload.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="buy.jsp"><img src="images/but_buy.jpg" alt="" width="146" height="40" /></a></li>
                    <li><a href="LogoutServlet"><img src="images/but_logout.jpg" alt="" width="147" height="40" /></a></li>
                </ul>
                <%}%>

            </div>
            <div class="headimage">
                <img src="images/picture.jpg" alt="" /> </div>
        </div>
        <div class="inside">

        </div>
        <div id="main">
            <div class="inside">
                  <%
                        if (session.getAttribute("status") != null) {
                    %>
                <div id="cpanel">
                    <h1><img src="images/cpanel.png" width="40" height="20" alt="User panel">User panel</h1>
                    <ul>
                        <li></li>
                        <li><img src="images/myaccount-icon.png" width="20" height="20" alt="my account"> <a href="account.jsp">My Account</a></li>
                        <li><img src="images/uploads_icon.png" width="20" height="20" alt="my uploads"><a href="myuploads.jsp"> My Uploads</a></li>
                        <li><img src="images/uploadicon.png" alt="upload"><a href="upload.jsp"> Upload File</a></li>
                        <li><img src="images/cart.png" width="20" height="20" alt="downlaod cart"><a href="downloadcart.jsp"> Download Cart</a></li>
                        <li><img src="images/buy_icon.png" width="20" height="20" alt="buy more"/><a href="buy.jsp">Buy more Space</a></li>
                    </ul>
                    <span><a href="LogoutServlet"> <img src="images/logout.png"/></a></span>
                </div>
                   <%}%>
                <div id="blocks">

                    <div class="upload">
                    <% Database database = new Database();
                    File file = database.getFile(fileid);
                    %>
                        <h3>File Details : <%=file.getName() %></h3>
                        <div id="upload-img"><img src="images/My-Downloads-icon.png" width="128" height="128"></div>
                        <div id="upload-text">
                            <div id="advanced" >
                                <table width="600">
                                    <tr><td width="100">Category</td>
                                        <td><%=file.getCategory() %></td>
                                    </tr>

                                    <tr><td>Description: </td>
                                        <td><%=file.getDescription() %></td>
                                    </tr>
                                    <tr><td width="100">Type</td>
                                        <td><%=file.getStatus()%></td>
                                    </tr>
                                    <tr><td width="100">Price</td>
                                        <td><%= file.getValue()%>
                                            &#8364;
                                        </td></tr>
                                    <% User user = (User) session.getAttribute("user");
                                    if ( user == null || ( user != null && file.getOwnerId() != user.getId()) ) {%>
                                    <tr><td width="160">Add to Download Cart</td>
                                        <%if (cart.contains(file.getID()) == false) {%>
                                        <td><a href="AddToCartServlet?fileid=<%=file.getID()%>"><img src="images/cart_put.png"></a></td>
                                                <%} else {%>
                                        <td><a href="DeleteFromCartServlet?fileid=<%=file.getID()%>"><img src="images/cart_remove.png"></a></td>
                                        <%}%>
                                    </tr>
                                    <%}%>
                                </table>
                                <p> <input value="Back" onclick="history.back()" type="image"  src="images/back.png" width="25" height="23">Back</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="footer">
            <div class="inside">
                <p>CloudShare &copy; 2010   |  Webdesign by Panoylhs &amp; Roumdic S.A.</p>
            </div>
        </div>
    </body>
</html>
